package com.ymtms.applicationsystem.vo;

import lombok.Data;

/**
 * @auther: autumn-luo
 * @description:
 * @createTime: 2019-10-27 11:58
 */
@Data
public class ResultUtil<T> {
    private int code;
    private String message;
    private T data;

    private ResultUtil() {

    }

    public static ResultUtil error(int code, String message) {
        ResultUtil resultBean = new ResultUtil();
        resultBean.setCode(code);
        resultBean.setMessage(message);
        return resultBean;
    }

    public static ResultUtil success() {
        ResultUtil resultBean = new ResultUtil();
        resultBean.setCode(0);
        resultBean.setMessage("success");
        return resultBean;
    }

    public static ResultUtil success(Object data) {
        ResultUtil resultBean = new ResultUtil();
        resultBean.setCode(0);
        resultBean.setMessage("success");
        resultBean.setData(data);
        return resultBean;
    }

}
